﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace cjhushi
{
    public class WoundedTreater
    {
        private int count;
        private int n;
        private int[] bloodV = new int[1001];
        

        public WoundedTreater(string input)
        {
            count = 0;
            string[] strInput = input.Split(" ");
            n = int.Parse(strInput[0]);
            for (int i = 1; i < strInput.Length; i++)
            {
                bloodV[i] = int.Parse(strInput[i]);

            }
            Array.Sort(bloodV, 1, n);
        }
        
        public int getResult()
        {
            for (int i = 1; i <= n; i++)
            {
                if (bloodV[i]>=i)
                {
                    count++;
                }
            }
            return count;
        }
    }
}
